****************************************************************************************
****************************************************************************************
** TABLE A3
****************************************************************************************
****************************************************************************************

use "${path}data_table.dta", clear


label var nbpub_same_labex "\emph{CollaPubs}"
label var npubs_outside "\emph{ExternalPubs}"
label var nb_collab_same_labex "\emph{Links}"
label var nb_first_same_labex    "\emph{NewLinks}"
label var nb_collabpub_same_labex "\emph{Collaborations}"
label var nb_collab_same_labex "\emph{Links}"
label var citations_new "\emph{Cites}"
gen age_2010 = age if year ==2010
bys id_20:  egen age_in_2010=max( age_2010)
drop age_2010
gen discipline=0
replace discipline=1 if biologie_fondamentale ==1
replace discipline=2 if recherche_medicale ==1
replace discipline=3 if biologie_appliquee_ecologie ==1
replace discipline=4 if chimie ==1
replace discipline=5 if physique ==1
replace discipline=6 if sciences_univers ==1
replace discipline=7 if sciences_ingenieur ==1
replace discipline=8 if mathematiques ==1
replace discipline=9 if SS ==1
replace discipline=10 if SH ==1
local regnom    "orga_rest_more_outcomes2"
eststo clear 
qui eststo:  reghdfe nbpub_same_labex treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe npubs_outside treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm 
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_first_same_labex treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_collabpub_same_labex treat2  if  id_year==1  & criterion_grade==1  ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm 
qui :  estadd scalar clusters = e(N_clust)
esttab,  compress ar2 starlevels(* 0.1 ** 0.05 *** 0.01)  b(%4.3f) se(%4.3f) label   keep(treat2) stats(N clusters   ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nose nonotes
esttab using  `regnom',   b(%4.3f) se(%4.3f) ar2 starlevels({$^{*}$} 0.1 {$^{**}$} 0.05 {$^{***}$} 0.01)  tex  label replace keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nonotes
eststo clear 
